<?php
/**
 * Created by PhpStorm.
 * User: 17828
 * Date: 2018/10/9
 * Time: 14:11
 */

namespace app\common\model;


use think\Model;

class Vehiclerent extends Model
{
    public function getVehicleRentList($field,$page,$limit,$where)
    {
        $list['data'] = db('vehicle_rent')->alias('v')
            ->field($field)
            ->join('cartype c', 'v.cartype_id = c.cartype_id')
            ->join('cartype ca', 'c.pid = ca.cartype_id')
            ->where($where)
            ->page($page,$limit)
            ->order('v.vehicle_rent_id desc')
            ->select();

        $list['count'] = db('vehicle_rent')->alias('v')
            ->field($field)
            ->join('cartype c', 'v.cartype_id = c.cartype_id')
            ->join('cartype ca', 'c.pid = ca.cartype_id')
            ->where($where)
            ->order('v.vehicle_rent_id desc')
            ->count();
        return $list;
    }
}